
import '../request/api_client.dart';
import '../request/response_data.dart';

class HomeAPI {

  //获取首页数据
  static Future<ResponseData> getHomeInfo(String sn) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/home/getHomeInfo",queryParameters: {
      'sn':sn
    });
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取设备数据接口
  static Future<ResponseData> getEquipmentInfo(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/Monitoring/getEquipmentInfo",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取设备所有数据接口
  static Future<ResponseData> getAllData(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/home/getAllData",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }


  //获取设备状态接口
  static Future<ResponseData> getEquipmentStatus(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/Monitoring/getEquipmentStatus",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取告警列表接口
  static Future<ResponseData> getMonitoringAlarm(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/Monitoring/getMonitoringAlarm",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取设备列表接口
  static Future<ResponseData> selectEquipmentInfo(String devStatus) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/selectEquipmentInfo",queryParameters: {
      'devStatus': devStatus
    });
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //获取设备详情接口
  static Future<ResponseData> getEquipmentInfoData(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/Monitoring/getEquipmentInfoData",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //设置设备名称接口
  static Future<ResponseData> deviceSetName(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/update",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  //设置参数回显
  static Future<ResponseData> getDevParameter(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/set/getDevParameter",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }
  //设置参数
  static Future<ResponseData> postDevParameter(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.post("/SPT/sys/app/set/postDevParameter",data: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  ///
  static Future<ResponseData> getHistoryData(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/home/getHistoryData",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }

  static Future<ResponseData> getEquipmentCity(Map<String,dynamic> data) async {
    ResponseData responseData = await ApiClient.get("/SPT/sys/app/getEquipmentCity",queryParameters: data);
    return ResponseData.createFrom(responseData, responseData.data);
  }
}